
#import "NSString+URLEncoding.h"
@implementation NSString (OAURLEncodingAdditions)
 
- (NSString *)URLEncodedString
{
    NSString *result = (NSString *)
       CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,
                                                  (CFStringRef)self,
                                                  NULL,
                                                  CFSTR("!*'();:@&amp;=+$,/?%#[] "),
                                                  kCFStringEncodingUTF8);
    [result autorelease];
    return result;
}
 
- (NSString*)URLDecodedString
{
    NSString *result = (NSString *)
       CFURLCreateStringByReplacingPercentEscapesUsingEncoding(kCFAllocatorDefault,
						(CFStringRef)self,
				 		CFSTR(""),
	  					kCFStringEncodingUTF8);
    [result autorelease];
    return result;
}
@end